function changeFace() {
    var reader = new FileReader();//定义文件读取流
    reader.readAsDataURL(document.getElementById("file").files[0]);
    reader.onload = function (ev) {
        document.getElementById("faceImg").src = ev.target.result;
    }
}
async function add() {
    var forObj = new FormData();
    forObj.append("uploadImg",$("file").files[0]);

    let config = {
        headers: {'Content-Type': 'multipart/form-data'}
    }
    var uploadFileName;

    await axios.post("/upload", forObj, config).then(resp => {
        uploadFileName = resp.data;
    });


    axios.get("/user/add", {
        params: {
            userName: $("name").value,
            password: $("password").value,
            userMail: $("mail").value,
            userImg: uploadFileName
        }
    }).then(resp => {
        var info = resp.data;
        if (info == "ok") {
            location.href = "/login.html";
        }else {
            info.forEach(n =>{
                $(n.field+"Span").innerHTML = n.defaultMessage;
            })

        }
    });
}